package com.njwb.day18.thd03;

public class JoinDemo01 {
    public static void main(String[] args) throws InterruptedException {


        for (int i = 0 ;i<15;i++) {
            if(i==5) {
                JoinThread joinThread = new JoinThread();
                joinThread.setName("半路杀出来的进程");
                joinThread.start();
                //main线程必须等待joinThread执行完毕后才会执行
                joinThread.join();
            }
            System.out.println("main:"+i);
            Thread.sleep(1000);

        }
    }
}
